var huizongbiao = new Vue({
    el : '#Huizongbiaolist',
    data:{
        xiangmuId : $("#xiangmuId").val(),
        xiangmu : {},
        HuizongbiaoList : [],
        show : false,
        total:0,

    },
    created : function() {
        var _this = this;

        $(".nav navbar-nav li").removeClass("active");
        $("#nav_huizongbiao").addClass("active");
        _this.bindHuizongbiaoList();
        _this.bindXiangmu();
    },
    methods : {



        bindXiangmu:function (){
            var _this = this;
            layer.open({type:3});
            $.post('/xiangmu/find_one', {
                xianmguid : _this.xiangmuId,
                rdm : Math.random()
            },function(ppData) {
                layer.closeAll("loading");
                if(ppData != null){
                    if(ppData.result == "1"){
                        var data = ppData.resultContent;
                        _this.xiangmu = data;
                    }else{
                        layer.alert(ppData.message);
                    }
                }
            },"json");
        },

        bindHuizongbiaoList:function (){
            var _this = this;
            layer.open({type:3});
            $.post("/chuangxinchanpinjieguo/findHuizongbiaolist",{
                xiangmuid : _this.xiangmuId,

                rdm : Math.random()
            },function(ppData){
                layer.closeAll("loading");
                if (ppData != null){
                    if(ppData.result == "1"){
                        var data=ppData.resultContent;
                        var mmHtml = "<div class='table-head'><table class=\"table table-hover table-bordered\" style=\"overflow:hidden; margin-bottom:10px;table-layout:fixed;\"  v-if=\"show\" cellspacing=\"0\" cellpadding=\"0\">\n" +
                            "   <thead > <tr>\n" +
                            "       <th rowspan='2' style=\"text-align:center;vertical-align:middle;width:50px;\" >排名</th>\n" +
                            "       <th rowspan='2' style=\"text-align:center;vertical-align:middle;width:50px;\" >序号</th>\n" +
                            "       <th rowspan='2' style=\"text-align:center;vertical-align:middle;width:120px;\">药品名称</th>\n" +
                            "       <th rowspan='2' style=\"text-align:center;vertical-align:middle;width:100px;\" >规格</th>\n" +
                            "       <th rowspan='2' style=\"text-align:center;vertical-align:middle;width:100px;\" >单位</th>\n" +
                            "       <th rowspan='2' style=\"text-align:center;vertical-align:middle;width:100px;\" >价格（元）</th>\n" +
                            "       <th rowspan='2' style=\"text-align:center;vertical-align:middle;\" >生产厂家</th>\n" +
                            "       <th rowspan='2' style=\"text-align:center;vertical-align:middle;width:180px;\" >执行时间</th>\n" +
                            "       <th colspan='2' style=\"text-align:center;vertical-align:middle;width:160px;\" >完成金额（万元）</th>\n" +
                            "       <th rowspan='2' style=\"text-align:center;vertical-align:middle;width:100px;\" >委员表决票数(同意数/总票数)</th>\n" +
                            "       <td rowspan='2' style=\"text-align:center;vertical-align:middle;width:100px;\" >表决结果</td>\n" +
                            "   </tr>" +
                            "<tr>" +
                            " <th  style=\"text-align:center;vertical-align:middle;width:80px;\" >院本部</th>\n" +
                            " <th  style=\"text-align:center;vertical-align:middle;width:80px;\" >秦淮</th>\n" +
                            "</tr>" +
                            "    </thead></table></div><div class='table-body'><table><tbody>";
                        if(data.length > 0){
                            _this.show = true;
                            _this.huizongbiaolist=data;
                            for (var i = 0; i < _this.huizongbiaolist.length; i++) {
                                var mmChuangxinOne = _this.huizongbiaolist[i];
                                var mmResult=mmChuangxinOne.result;
                                var mmId=mmChuangxinOne.id;

                                var mmpaixuhao = mmChuangxinOne.ordernumber;
                                var mmyaowumingcheng = mmChuangxinOne.yaopinmingcheng;
                                var mmguige = mmChuangxinOne.guige;
                                var mmdanwei = mmChuangxinOne.danwei;
                                var mmjiage = mmChuangxinOne.jiage;
                                var mmshengchanchangjia = mmChuangxinOne.shengchanchangjia;
                                var mmzhixingshijian = mmChuangxinOne.zhixingshijian;
                                var mmyuanbenbu = mmChuangxinOne.yuanbenbu;
                                var mmqinhuai = mmChuangxinOne.qinhuai;
                                var mmpiaoshu = mmChuangxinOne.piaoshu;
                                var mmjieguo=mmChuangxinOne.jieguo;
                                var mmpaixu = i+1;

                                mmHtml += "<td style='text-align:center;vertical-align:middle;width:50px;'>" + mmpaixu + "</td>";
                                mmHtml += "<td style='text-align:center;vertical-align:middle;width:50px;'>" + mmpaixuhao + "</td>";
                                mmHtml += "<td style='text-align:center;vertical-align:middle;width:120px;'>" + mmyaowumingcheng + "</td>";
                                mmHtml += "<td style='text-align:center;vertical-align:middle;width:100px;'>" + mmguige + "</td>";
                                mmHtml += "<td style='text-align:center;vertical-align:middle;width:100px;'>" + mmdanwei + "</td>";
                                mmHtml += "<td style='text-align:center;vertical-align:middle;width:100px;'>" + mmjiage + "</td>";
                                mmHtml += "<td style='text-align:center;vertical-align:middle;width:'>" + mmshengchanchangjia + "</td>";
                                mmHtml += "<td style='text-align:center;vertical-align:middle;width:180px;'>" + mmzhixingshijian + "</td>";
                                mmHtml += "<td style='text-align:center;vertical-align:middle;width:80px;'>" + mmyuanbenbu + "</td>";
                                mmHtml += "<td style='text-align:center;vertical-align:middle;width:80px;'>" + mmqinhuai + "</td>";
                                mmHtml +="<td style='text-align:center;vertical-align:middle;width: 100px;height: 100%'>" + mmpiaoshu + "</td>";
                                if(mmjieguo=='通过'){
                                    mmHtml += "<td style='text-align:center;vertical-align:middle;width:100px;color: green'>" + mmjieguo + "</td>";
                                }else {
                                    mmHtml += "<td style='text-align:center;vertical-align:middle;width:100px;color: red'>" + mmjieguo + "</td>";
                                }
                                mmHtml += "</tr>";

                            }



                        }else {
                            _this.show = false;
                        }
                        mmHtml += "</table>";
                        $("#List").html(mmHtml);
                    }else{
                        layer.alert(ppData.message);
                    }
                }

            },"json");
        },



    },
    watch :{
        //监控分页情况，刷新列表
        pageIndex : function(){

            this.bindHuizongbiaoList();
        }
    }
})